Page({
  data:{
    ordersTab:[
      {name: '待付款',icon:'bill-o',info:2,index:1},
      {name: '待发货',icon:'logistics',info:'',index:2},
      {name: '待收货',icon:'todo-list-o',info:'',index:3},
      {name: '待评价',icon:'comment-o',info:'',index:4},
      {name: '退款/售后',icon:'after-sale',info:'',index:5}
    ],
  },
  onShow() {
  },
  toPersonal(e) {
    wx.navigateTo({url: '/pages/usercenter/person-info/index'});
  },
  toOrders(e) {
    let index = e.currentTarget.dataset.index;
    let url='/pages/usercenter/orders/index?tab_active='+index;
    if(index==5) {
      url='/pages/usercenter/after-selling/index';
    }
    wx.navigateTo({url: url});
  },
  onClickCell(e) {
    let name=e.detail.name;
    if(name=='收货地址'){
      wx.navigateTo({url: '/pages/usercenter/address/list/index?from=user_center',});
    }else if(name=='优惠券'){
      wx.navigateTo({url: '/pages/usercenter/coupons/index',});
    }else if(name=='客服热线'){
      this.setData({customerShowed:true});
    }else{
      wx.showToast({title: name,});
    }
  },
  onCustomerClose(e) {
    this.setData({customerShowed:false});
  },
  makeACall(e) {
    this.setData({customerShowed:false});
    wx.makePhoneCall({
      phoneNumber: e.currentTarget.dataset.phone, 
      success: function() {
        // console.log('拨打手机号' + phone)
      },
      fail: function() {
        // console.log("拨打手机号失败")
      }
    });
  },
  
})
